<script setup lang="ts">
import {TresCanvas, useLoader} from '@tresjs/core';
import {GLTFLoader} from "three/examples/jsm/loaders/GLTFLoader";
// 模型路径
const modelPath = '@/assets/models/usagi.gltf';

// GLTF 模型组件
const GLTFModel = await useLoader(GLTFLoader, modelPath);
</script>

<template>
    <TresCanvas>
        <!-- 场景 -->
        <TresPerspectiveCamera :position="[0, 2, 5]" />
        <TresAmbientLight :intensity="0.5" />
        <TresDirectionalLight :position="[10, 10, 10]" :intensity="1" />

        <!-- 加载 GLTF 模型 -->
        <Suspense>
            <GLTFModel :path="modelPath" />
        </Suspense>

        <!-- 轨道控制器 -->
        <TresOrbitControls />
    </TresCanvas>
</template>

<style scoped>
header {
    line-height: 1.5;
}

.logo {
    display: block;
    margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
    header {
        display: flex;
        place-items: center;
        padding-right: calc(var(--section-gap) / 2);
    }

    .logo {
        margin: 0 2rem 0 0;
    }

    header .wrapper {
        display: flex;
        place-items: flex-start;
        flex-wrap: wrap;
    }
}
</style>
